from client import MCPClient


def pagination():
    client = MCPClient("http://localhost:8000")
    if not client.initialize():
        return
    print(f"连接服务器成功")
    result = client.list_tools(page_size=5)
    print(
        f"工具列表第{result['page']}页，{len(result['tools'])}/{result['total']}个工具,是否有下一页:{result['has_next']}"
    )
    if result["has_next"]:
        print(f"获取下一页")
        next_result = client.list_tools(cursor=result["next_cursor"], page_size=5)
        print(
            f"工具列表第{next_result['page']}页，{len(next_result['tools'])}/{next_result['total']}个工具,是否有下一页:{next_result['has_next']}"
        )


if __name__ == "__main__":
    pagination()
